1. Technical Field
The present invention relates to a line-direction deciding device, an image-inclination detecting device and an image-inclination correcting device, all of which are adapted to use in a printed image processing device and a character recognizing device.
2. Description of the Related Art
In processing an image of a printed original in particular for recognizing characters therein, it is very important to decide the direction of lines of characters thereon, i.e., whether characters are printed in vertical lines or horizontal lines. This is because the character extracting processing in many cases depends on the direction of character lines.
Many conventional methods for deciding a line-direction use the marginal distribution in vertical and horizontal directions of an input image. A typical method is described in Technical Reports of IEICE No. PRL80-70 published by The Institute of Electronics, Information and Communication Engineer. This method uses blank lines extracted by the marginal distribution, which depend upon vertical character line and horizontal character line.
A line-direction deciding method not using the marginal distribution has been also proposed, for example, in Japanese Laid-Open Patent Publication No. 4-90082. This method prepares a histogram of run length of white pixels (blanks) in vertical and horizontal directions and discriminates the direction of lines by comparing a peak of white pixels in vertical direction with a peak of white pixels in horizontal direction. The method is based on the fact that characters typed in horizontal lines have smaller horizontal spacing than vertical spacing while characters typed in vertical lines have smaller vertical spacing than horizontal spacing.
The above-described conventional line-direction deciding methods and devices, however, involve the following problems:
The first problem is that the method using the marginal distribution may sometimes fail in obtaining a correct discrimination of a character line direction on a printed image with a complicated layout of characters therein. This is because whole-area marginal distribution can not always detect blanks around respective character strings on an original image having a complicated layout of characters therein.
The second problem is that the method using run-length of blanks extracts information on runs of blanks from a wide area of an input image, which is usable only for the line-direction deciding process and cannot be used in many cases for other kinds of processing, e.g., character recognizing processing. In other words, much time and many operating resources must be consumed for obtaining information usable for only extracting the direction of lines. This decreases the efficiency of operation of the device.
The third problem is that the method using run-length of blanks is limited in detectable line directions as shown in FIG. 1. Namely, the method cannot discriminate any direction other than vertical 20 and horizontal 21 directions and directions 22 and 23 having an angle of a multiple of 45xc2x0, in which run lengths can be naturally decided. This means that an image input from a printed sheet at a large inclination angle cannot be correctly processed without previously being corrected for its inclination. The method may have a trouble with images input from a hand-operated scanner or a camera, which are apt to easily be inclined. For discriminating the direction having an angle of a multiple of 45xc2x0, it is necessary to excessively access the image storage means (image memory) for calculating a run-length in that direction as compared with the discrimination of the horizontal or vertical direction. Scanning the image memory at an inclination results in further increasing processing time due to accessing discrete addresses therein by calculating these addresses. Of course, the method using the vertical and horizontal marginal distribution cannot discriminate any direction other than the vertical and horizontal directions.
The fourth problem is that both the methods using the marginal distribution and run-length of blanks are limited in detectable line directions and, therefore, processing results obtained from an input image by these methods cannot be used for detecting and/or correcting inclination of the image. Consequently, the conventional line-direction deciding device must be provided with a separate image-inclination detecting device and a separate image-inclination correcting device. This makes the system large and very expensive.
Accordingly, the present invention is directed to a line-direction deciding device that can process any image with a complicated layout of characters included therein, providing many interprocessing results usable in common for other kinds of processing (e.g., character recognition), and can be easily expanded to discrimination of any directions other than vertical and horizontal directions. The present invention is also directed to an image inclination detecting device and an image inclination correcting device, both of which effectively use the processing results obtained by the line-direction deciding device.
(1) It is therefore one object of the present invention to provide a line-direction deciding device which comprises image storing means for storing an input image, character-element-extracting means for extracting character elements from the image stored in the image storing means, character-element density calculating means for determining the density of character elements in each of predetermined directions and line-direction deciding means for deciding a character line direction by detecting a direction in which character elements are most densely distributed.
(2) Another object of the present invention is to provide a line-direction deciding device set forth in the paragraph (1), which is further characterized in that the predetermined plural directions are directions of divisions formed by dividing a circle with center at a representative point of a bounding rectangle of the character element.
(3) Another object of the present invention is to provide a line-direction deciding device set forth in the paragraph (1) or (2), which is further characterized in that the character-element density calculating means is provided with means for determining a shortest distance from the character element to each of adjacent character elements in each of the predetermined plural directions and the line-direction deciding means compares the distances between the character elements in respective directions and decides by majority the direction in which character-elements are most densely distributed.
(4) Another object of the present invention is to provide a line-direction deciding device set forth in the paragraph (1) or (2), which is further characterized in that the character-element density calculating means includes means for determining first a shortest distance from a character element to a neighbor in each of the predetermined directions and then deciding a larger distance between the character elements in a direction as an interelement distance in that direction and the line-direction deciding means compares the distances between the character elements in respective directions and decides by majority the direction in which character elements are most densely distributed.
(5) Another object of the present invention is to provide a line-direction deciding device set forth in the paragraph (2), which is further characterized in that the character element density is determined by counting how many representative points of the bounding rectangles of respective character elements included in respective divisions of the circle with center at a character element.
(6) Another object of the present invention is to provide an image-inclination detecting device that comprises the line-direction deciding device set forth in any one of paragraphs (1) to (5) and image-inclination detecting means for detecting an inclination of an input image by comparing the character line direction determined by the line-direction deciding device to a reference line direction.
(7) Another object of the present invention is to provide an image-inclination correcting device that comprises the image-inclination detecting device set forth in the paragraph (6) and image-inclination correcting means for correcting an inclination of an input image according to a result obtained by the image-inclination detecting device.